<?php
class WeiboCommentService extends BaseDbService
{
	public function __construct()
	{
		$this->dao	= new BaseDao('weibo_comment');
	}
	
	public function addComment($data)
	{
		$result = $this->add($data);
		if ($result)
		{
			$weiboService	= new BaseDbService('weibo');
			$weiboService->update($data['weibo_id'], array('comment_num'=>'expression:comment_num+1'));
		}
		
		return $result;
	}
	
	public function delComment($id){
		if ($data = $this->get($id)){
			$this->del($id);
			$weiboService	= new BaseDbService('weibo');
			$weiboService->update($data['weibo_id'], array('comment_num'=>'expression:comment_num-1'));
			return true;
		}
		return false;
	}
	
}